package com.yili.oa.dao;

import com.yili.oa.models.FtBetRecord;
import com.yili.oa.models.FtBetRecordExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface FtBetRecordMapper {
    @SelectProvider(type=FtBetRecordSqlProvider.class, method="countByExample")
    long countByExample(FtBetRecordExample example);

    @DeleteProvider(type=FtBetRecordSqlProvider.class, method="deleteByExample")
    int deleteByExample(FtBetRecordExample example);

    @Delete({
        "delete from ft_bet_record",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);

    @Insert({
        "insert into ft_bet_record (create_time_utc, bet_no, ",
        "bet_amount, pie_awarded, ",
        "payout_time_utc, game_kind, ",
        "game_platform, game_id, ",
        "user_id, xima_time)",
        "values (#{createTimeUtc,jdbcType=BIGINT}, #{betNo,jdbcType=VARCHAR}, ",
        "#{betAmount,jdbcType=DECIMAL}, #{pieAwarded,jdbcType=DECIMAL}, ",
        "#{payoutTimeUtc,jdbcType=BIGINT}, #{gameKind,jdbcType=INTEGER}, ",
        "#{gamePlatform,jdbcType=INTEGER}, #{gameId,jdbcType=INTEGER}, ",
        "#{userId,jdbcType=BIGINT}, #{ximaTime,jdbcType=TIMESTAMP})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Long.class)
    int insert(FtBetRecord record);

    @InsertProvider(type=FtBetRecordSqlProvider.class, method="insertSelective")
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Long.class)
    int insertSelective(FtBetRecord record);

    @SelectProvider(type=FtBetRecordSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="create_time_utc", property="createTimeUtc", jdbcType=JdbcType.BIGINT),
        @Result(column="bet_no", property="betNo", jdbcType=JdbcType.VARCHAR),
        @Result(column="bet_amount", property="betAmount", jdbcType=JdbcType.DECIMAL),
        @Result(column="pie_awarded", property="pieAwarded", jdbcType=JdbcType.DECIMAL),
        @Result(column="payout_time_utc", property="payoutTimeUtc", jdbcType=JdbcType.BIGINT),
        @Result(column="game_kind", property="gameKind", jdbcType=JdbcType.INTEGER),
        @Result(column="game_platform", property="gamePlatform", jdbcType=JdbcType.INTEGER),
        @Result(column="game_id", property="gameId", jdbcType=JdbcType.INTEGER),
        @Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT),
        @Result(column="xima_time", property="ximaTime", jdbcType=JdbcType.TIMESTAMP)
    })
    List<FtBetRecord> selectByExample(FtBetRecordExample example);

    @Select({
        "select",
        "id, create_time_utc, bet_no, bet_amount, pie_awarded, payout_time_utc, game_kind, ",
        "game_platform, game_id, user_id, xima_time",
        "from ft_bet_record",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="create_time_utc", property="createTimeUtc", jdbcType=JdbcType.BIGINT),
        @Result(column="bet_no", property="betNo", jdbcType=JdbcType.VARCHAR),
        @Result(column="bet_amount", property="betAmount", jdbcType=JdbcType.DECIMAL),
        @Result(column="pie_awarded", property="pieAwarded", jdbcType=JdbcType.DECIMAL),
        @Result(column="payout_time_utc", property="payoutTimeUtc", jdbcType=JdbcType.BIGINT),
        @Result(column="game_kind", property="gameKind", jdbcType=JdbcType.INTEGER),
        @Result(column="game_platform", property="gamePlatform", jdbcType=JdbcType.INTEGER),
        @Result(column="game_id", property="gameId", jdbcType=JdbcType.INTEGER),
        @Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT),
        @Result(column="xima_time", property="ximaTime", jdbcType=JdbcType.TIMESTAMP)
    })
    FtBetRecord selectByPrimaryKey(Long id);

    @UpdateProvider(type=FtBetRecordSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") FtBetRecord record, @Param("example") FtBetRecordExample example);

    @UpdateProvider(type=FtBetRecordSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") FtBetRecord record, @Param("example") FtBetRecordExample example);

    @UpdateProvider(type=FtBetRecordSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(FtBetRecord record);

    @Update({
        "update ft_bet_record",
        "set create_time_utc = #{createTimeUtc,jdbcType=BIGINT},",
          "bet_no = #{betNo,jdbcType=VARCHAR},",
          "bet_amount = #{betAmount,jdbcType=DECIMAL},",
          "pie_awarded = #{pieAwarded,jdbcType=DECIMAL},",
          "payout_time_utc = #{payoutTimeUtc,jdbcType=BIGINT},",
          "game_kind = #{gameKind,jdbcType=INTEGER},",
          "game_platform = #{gamePlatform,jdbcType=INTEGER},",
          "game_id = #{gameId,jdbcType=INTEGER},",
          "user_id = #{userId,jdbcType=BIGINT},",
          "xima_time = #{ximaTime,jdbcType=TIMESTAMP}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(FtBetRecord record);
}